package com.twitterbuzz.server;

import java.util.Comparator;
import java.util.Map;

public class doubleComparator implements Comparator {
	@Override
	public int compare(Object obj1, Object obj2){
		int result=0;
		Map.Entry e1 = (Map.Entry)obj1 ;
		Map.Entry e2 = (Map.Entry)obj2 ;
		Double value1 = (Double)e1.getValue();
		Double value2 = (Double)e2.getValue();
		if(value1.compareTo(value2)==0){				
			String int1=(String)e1.getKey();
			String int2=(String)e2.getKey();
			result=int1.compareTo(int2);
		} else{
			result=value2.compareTo(value1);
		}
		return result;
	}
}
